package com.springcloud.system.user.util;

import com.springcloud.common.entity.SystemUser;
import com.springcloud.common.web.util.AbstractUserContextHolder;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * <p>  </p>
 *
 * @author mori
 * @since 11/8/2019 10:13 AM
 */
@Component
public class SystemUserContextHolder extends AbstractUserContextHolder<SystemUser> implements InitializingBean {

    private static SystemUserContextHolder holder;

    @Override
    public void afterPropertiesSet() {
        holder = this;
    }

    private static SystemUserContextHolder getHolder(){
        return holder;
    }

    public static SystemUser getSystemUser(){
        return getHolder().getContext();
    }

}
